/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.OneCommerceProject.controllers.util;

import com.OneCommerceProject.beans.PhotosFacade;
import com.OneCommerceProject.controllers.PhotosController;
import com.OneCommerceProject.entities.Photos;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.primefaces.model.StreamedContent;

/**
 *
 * @author Malek
 */
@SessionScoped
@ManagedBean(name="galleriaBean")
public class GalleriaBean {
    private List<BigDecimal> images;  
    @EJB
    private PhotosFacade photosFacade;

    
    @PostConstruct  
    public void init() throws FileNotFoundException, IOException {  
        images = new ArrayList<BigDecimal>();  
        
        
        
    }  
  
    public List<BigDecimal> getImages() {  
        List<Photos> listPhotos = photosFacade.findAll();
        List<BigDecimal> imagesId = new ArrayList<BigDecimal>();
        for(Photos item : listPhotos) { 
            imagesId.add(item.getIdphoto());  
        }  
        return imagesId;  
    }
}
